<%@ page import="java.util.Date" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>学生考试成绩</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }

	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/teach/teachExam/">学生考试成绩列表</a></li>
		<%--<shiro:hasPermission name="teach:teachExam:edit"><li><a href="${ctx}/teach/teachExam/form">考试管理添加</a></li></shiro:hasPermission>--%>
	</ul>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>考试科目名称</th>
				<th>考试状态</th>
				<th>参与此次考试学生姓名</th>
				<th>考卷名称</th>
				<th>查看该学生答题情况</th>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="teachExam">
			<%
				java.util.Date dt = new Date();
				long nowTime = dt.getTime();   //得到秒数，Date类型的getTime()返回毫秒数
				request.setAttribute("nowTime", nowTime);
			%>
			<tr>
				<td>
					${teachExam.examName}
				</td>
				<td>
					<c:if test="${(nowTime-teachExam.endDate.getTime())>0}">
						已结束
					</c:if>
					<c:if test="${(teachExam.beginDate.getTime()-nowTime)>0}">
						未开始
					</c:if>
					<c:if test="${(nowTime-teachExam.endDate.getTime())<0&&(teachExam.beginDate.getTime()-nowTime)<0}">
						进行中
					</c:if>
					<%--${fns:getDictLabel(teachExam.examStatus, 'exam_status', '')}--%>
				</td>
				<td>
					${teachExam.name}
				</td>
				<td>
					${teachExam.paperName}
				</td>
				<td>
					<c:choose>
						<c:when test="${(nowTime-teachExam.endDate.getTime())>0}">
							<a href="${ctx}/teach/teachExam/stuExam?examId=${teachExam.id}&userId=${teachExam.userId}">查看该生答题情况</a>
						</c:when>
						<c:otherwise>
							考试未结束，请等待
						</c:otherwise>
					</c:choose>
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>